package com.zxw.user.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.zxw.common.core.base.res.BaseRes;
import com.zxw.user.api.EmailAPI;
import com.zxw.user.domain.vo.EmailVO;
import com.zxw.user.service.EmailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author Xuewei.Zhang
 * @date 2022/12/2
 */
@Api(tags = "邮件模块")

@RequestMapping("/email")
@RestController
@RequiredArgsConstructor
@Slf4j
public class EmailController implements EmailAPI {

    private final EmailService emailService;

    @ApiOperationSupport(author = "Xuewei.Zhang")
    @ApiOperation("发送验证码")
    @PostMapping("/send-verification-code")
    public BaseRes sendEmailVerificationCode(@RequestBody EmailVO email) {
        log.info("发送验证码...");
        emailService.sendVerificationCode(email.getEmail());
        return BaseRes.okSend();
    }


}
